#ifndef __PARTHUS_SYS_FEATURES__
#define __PARTHUS_SYS_FEATURES__

/***********************************************************************
 *
 * MODULE NAME:    sys_features.h
 * PROJECT CODE:   BlueStream
 * MAINTAINER:     Ivan Griffin/John Nelson
 * DATE:           Wed Jul 14 11:39:10 BST 1999
 *
 * SOURCE CONTROL: $Id: sys_features.h,v 1.71 2009/12/30 11:04:52 tianwq Exp $
 *
 * LICENCE:
 *    This source code is copyright (c) 1999-2004 Ceva Inc.
 *    All rights reserved.
 *
 * REVISION HISTORY:
 *
 * This file is to be used for grouping features, both
 * LMP and Parthus extended features.
 *
 ***********************************************************************/

#ifndef PRH_BS_FEATURES_DEFINITION_FILE_EXISTS

/*
 * No external definition of options therefore set up below.
 * Notes
 * 1. Define PRH_BS_CFG_SELECT_LEVEL to 0|1|2|3|4
 *    PRH_BS_CFG_SELECT_LEVEL is a local configuration parameter to allow
 *    rapid minimal/default/maximum/specials configuration
 * 2. Should be always externally defined (never commit to code database).
 *    PRH_BS_CFG_SELECT_LEVEL will normally be specified in a make file.
 *    If not specified the build will be default.
 */

#ifndef PRH_BS_CFG_TABASCO_VERSION
#define PRH_BS_CFG_TABASCO_VERSION      PRH_BS_HW_TABASCO_VERSION_T1_0_0
#endif

#ifndef PRH_BS_CFG_LOCAL_NAME
#define PRH_BS_CFG_LOCAL_NAME        "RDA Headset/Hid"
#endif

#define PRH_BS_CFG_LMP_VERSION        5
#define PRH_BS_CFG_LMP_SUBVERSION     0x000d
#define PRH_BS_CFG_HCI_VERSION        PRH_BS_CFG_LMP_VERSION
#define PRH_BS_CFG_HCI_REVISION       PRH_BS_CFG_LMP_SUBVERSION

#ifndef PRH_BS_CFG_MANUFACTURER_NAME
#define PRH_BS_CFG_MANUFACTURER_NAME  0x61
#endif

#if !defined(PRH_BS_CFG_SELECT_LEVEL)
#define PRH_BS_CFG_SELECT_LEVEL      3   /* 1: v2.0, 2: V2.1, 3: V3.0, 4:V4.0 5: headset and hid, 6: stero, 7: cordless */
#endif

#define mSYSfeatures_Select_Min_Default_Max(v2_edr,v21_edr,v3,v4,hs_hid,st_hs,cordless) \
  ((0xFF*(PRH_BS_CFG_SELECT_LEVEL==1) & v2_edr)| (0xFF*(PRH_BS_CFG_SELECT_LEVEL==2) & v21_edr)| \
  (0xFF*(PRH_BS_CFG_SELECT_LEVEL==3) & v3)| (0xFF*(PRH_BS_CFG_SELECT_LEVEL==4) & v4) | \
  (0xFF*(PRH_BS_CFG_SELECT_LEVEL==5) & hs_hid)| (0xFF*(PRH_BS_CFG_SELECT_LEVEL==6) & st_hs)| \
  (0xFF*(PRH_BS_CFG_SELECT_LEVEL==7) & cordless))

/*
 * LMP Features Bytes 0..7   Configurations(V2.0, V2.1, V3.0, V4.0, hs_hid, st_hs, cordless)
 */
#define PRH_BS_CFG_BYTE_0   mSYSfeatures_Select_Min_Default_Max(0xFB, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF, 0xBD)
#define PRH_BS_CFG_BYTE_1   mSYSfeatures_Select_Min_Default_Max(0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFE)
#define PRH_BS_CFG_BYTE_2   mSYSfeatures_Select_Min_Default_Max(0x8D, 0x8D, 0x8D, 0x8D, 0x8D, 0x8D, 0x8D)
#define PRH_BS_CFG_BYTE_3   mSYSfeatures_Select_Min_Default_Max(0xFE, 0xFE, 0xFE, 0xFE, 0xfe, 0x8E, 0x88)
#define PRH_BS_CFG_BYTE_4   mSYSfeatures_Select_Min_Default_Max(0x9B, 0x9B, 0x9B, 0x9B, 0x9B, 0x88, 0x18)
#define PRH_BS_CFG_BYTE_5   mSYSfeatures_Select_Min_Default_Max(0xF9, 0xFF, 0xFF, 0xFF, 0xf9, 0x18, 0x18)
#define PRH_BS_CFG_BYTE_6   mSYSfeatures_Select_Min_Default_Max(0x00, 0x79, 0x79, 0x79, 0x59, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_7   mSYSfeatures_Select_Min_Default_Max(0x80, 0x83, 0x87, 0x87, 0x80, 0x80, 0x00)

#define PRH_BS_CFG_BYTE_8    mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_9    mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_10   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_11   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_12   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_13   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_14   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
#define PRH_BS_CFG_BYTE_15   mSYSfeatures_Select_Min_Default_Max(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)

/*
 * PRH Features Bytes 16..23  Configurations(V2.0, V2.1, V3.0, V4.0, hs_hid, st_hs, cordless)
 */
#define PRH_BS_CFG_BYTE_16  mSYSfeatures_Select_Min_Default_Max(0x7F, 0xFF, 0xFF, 0xFF, 0x0c, 0x04, 0xc4)
#define PRH_BS_CFG_BYTE_17  mSYSfeatures_Select_Min_Default_Max(0xA7, 0xA7, 0xA7, 0xA7, 0x86, 0x86, 0x86)
#define PRH_BS_CFG_BYTE_18  mSYSfeatures_Select_Min_Default_Max(0xFF, 0xFF, 0xFF, 0xFF, 0x3e, 0x16, 0x16)
#define PRH_BS_CFG_BYTE_19  mSYSfeatures_Select_Min_Default_Max(0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0xB0, 0xF0)
#define PRH_BS_CFG_BYTE_20  mSYSfeatures_Select_Min_Default_Max(0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01)
#define PRH_BS_CFG_BYTE_21  mSYSfeatures_Select_Min_Default_Max(0x24, 0x25, 0x65, 0x65, 0x04, 0x04, 0x44)
#define PRH_BS_CFG_BYTE_22  mSYSfeatures_Select_Min_Default_Max(0x03, 0x07, 0x07, 0x07, 0xc1, 0xc1, 0xc1)
#define PRH_BS_CFG_BYTE_23  mSYSfeatures_Select_Min_Default_Max(0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00)
#endif /* #ifndef PRH_BS_FEATURES_DEFINITION_FILE_EXISTS */

/*
 * The number of features pages is the number of features bytes divided by 8
 */
#define NUM_FEATURES_PAGES      2

#define LC_DEFERRED_PAYLOAD_EXTRACTION_SUPPORTED 0

#define FLASH_BUILD                     1
#define UNIT_TEST_BUILD                 2
#define DEBUG_BUILD                     3
#define RF_TESTER_BUILD                 5
#define COMBINED_BUILD                  6
#define GENERIC_BUILD                   7

/* rda product type define */
#define RDA_STANDARD_CHIP               0x00        /* rda5868 */
#define RDA_HID_CHIP                    0x01        /* rda5871 */
#define RDA_MONO_HEADSET                0x02        
#define RDA_HID_HEADSET                 0x03        /* rda5873 */
#define RDA_COMBINED_CHIP               0x04
#define RDA_MOBILE_CHIP                 0x08        /* rda5870/rda5872/rda5875/rda5876 */
#define RDA_STEREO_HEADSET              0x20        
#define RDA_USB_DONGLE                  0x40
#define RDA_CORDLESS_PHONE		        0x80	    /* rda5877 */

#if(RDA_PRODUCT==RDA_CORDLESS_PHONE)
#define PRH_BS_CFG_CHIP_ID            0x5877
#elif(RDA_PRODUCT==RDA_HID_HEADSET)
#define PRH_BS_CFG_CHIP_ID            0x5873
#elif(RDA_PRODUCT==RDA_STEREO_HEADSET)
#define PRH_BS_CFG_CHIP_ID            0x5871
#else
#define PRH_BS_CFG_CHIP_ID            0x5868
#endif


/*
 * Host Controller Configuration Options that are normally fixed for normal
 * HC Builds
 */
#define NDEBUG 0
#define STATIC static

/*
 * Host Controller Configuration Options that are variable but proven
 */
#define TABASCO_OLD_SER_BLK_SUPPORTED 1

/***********************************************************************
 * LMP Features (as per Bluetooth LMP features)
 *
 * (effectively HC system features)
 *
 *
 * Note each <feature_name> has two associated definitions:
 *
 * #define PRH_BS_CFG_SYS_<feature_name>_FEATURE           0x0000
 * #define PRH_BS_CFG_SYS_<feature_name>_SUPPORTED         0
 ***********************************************************************/

#define mSYSfeatures_Check_Feature(Feature_Short_Name, Byte_Num)        \
     ( ( PRH_BS_CFG_##Feature_Short_Name##_FEATURE &0xFF &              \
         PRH_BS_CFG_BYTE_##Byte_Num ) != 0 )

#define mSYSfeatures_Extract_Feature_Bit(Feature_Short_Name)            \
     (   PRH_BS_CFG_##Feature_Short_Name##_FEATURE &                    \
         (PRH_BS_CFG_##Feature_Short_Name##_SUPPORTED*0xFF)  )

#define mSYSfeatures_Extract_Feature_Combined_Byte(b0, b1, b2, b3, b4, b5, b6, b7) \
( mSYSfeatures_Extract_Feature_Bit(b0) |                                \
  mSYSfeatures_Extract_Feature_Bit(b1) |                                \
  mSYSfeatures_Extract_Feature_Bit(b2) |                                \
  mSYSfeatures_Extract_Feature_Bit(b3) |                                \
  mSYSfeatures_Extract_Feature_Bit(b4) |                                \
  mSYSfeatures_Extract_Feature_Bit(b5) |                                \
  mSYSfeatures_Extract_Feature_Bit(b6) |                                \
  mSYSfeatures_Extract_Feature_Bit(b7) )

#define PRH_BS_CFG_SYS_UNDEFINED_FEATURE                    0x0000
#define PRH_BS_CFG_SYS_UNDEFINED_SUPPORTED                  0

/*
 * LMP Feature definition 0xBBbb   BB byte position, bb bit position
 */
#define PRH_BS_CFG_SYS_LMP_THREE_SLOT_PKT_FEATURE           0x0001
#define PRH_BS_CFG_SYS_LMP_FIVE_SLOT_PKT_FEATURE            0x0002
#define PRH_BS_CFG_SYS_LMP_ENCRYPTION_FEATURE               0x0004
#define PRH_BS_CFG_SYS_LMP_SLOT_OFFSET_FEATURE              0x0008
#define PRH_BS_CFG_SYS_LMP_TIMING_INFO_FEATURE              0x0010
#define PRH_BS_CFG_SYS_LMP_MSS_FEATURE                      0x0020
#define PRH_BS_CFG_SYS_LMP_HOLD_FEATURE                     0x0040
#define PRH_BS_CFG_SYS_LMP_SNIFF_FEATURE                    0x0080

#define PRH_BS_CFG_BYTE_0_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_THREE_SLOT_PKT, SYS_LMP_FIVE_SLOT_PKT, \
        SYS_LMP_ENCRYPTION, SYS_LMP_SLOT_OFFSET, \
        SYS_LMP_TIMING_INFO, SYS_LMP_MSS, SYS_LMP_HOLD, SYS_LMP_SNIFF)

#define PRH_BS_CFG_SYS_LMP_PARK_FEATURE                     0x0101
#define PRH_BS_CFG_SYS_LMP_RSSI_FEATURE                     0x0102
#define PRH_BS_CFG_SYS_LMP_CHANNEL_DRIVEN_QUALITY_FEATURE   0x0104
#define PRH_BS_CFG_SYS_LMP_SCO_FEATURE                      0x0108
#define PRH_BS_CFG_SYS_LMP_HV2_FEATURE                      0x0110
#define PRH_BS_CFG_SYS_LMP_HV3_FEATURE                      0x0120
#define PRH_BS_CFG_SYS_LMP_U_LAW_FEATURE                    0x0140
#define PRH_BS_CFG_SYS_LMP_A_LAW_FEATURE                    0x0180

#define PRH_BS_CFG_BYTE_1_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_PARK, SYS_LMP_RSSI, SYS_LMP_CHANNEL_DRIVEN_QUALITY, SYS_LMP_SCO, \
        SYS_LMP_HV2, SYS_LMP_HV3, SYS_LMP_U_LAW, SYS_LMP_A_LAW)

#define PRH_BS_CFG_SYS_LMP_CVSD_FEATURE                     0x0201
#define PRH_BS_CFG_SYS_LMP_OPTIONAL_PAGING_FEATURE          0x0202
#define PRH_BS_CFG_SYS_LMP_POWER_CONTROL_FEATURE            0x0204
#define PRH_BS_CFG_SYS_LMP_TRANSPARENT_SCO_FEATURE          0x0208
#define PRH_BS_CFG_SYS_LMP_FC_LAG0_FEATURE                  0x0210
#define PRH_BS_CFG_SYS_LMP_FC_LAG1_FEATURE                  0x0220
#define PRH_BS_CFG_SYS_LMP_FC_LAG2_FEATURE                  0x0240
#define PRH_BS_CFG_SYS_LMP_BROADCAST_ENCRYPTION_FEATURE     0x0280

#define PRH_BS_CFG_BYTE_2_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_CVSD, SYS_LMP_OPTIONAL_PAGING, \
        SYS_LMP_POWER_CONTROL, SYS_LMP_TRANSPARENT_SCO, \
        SYS_LMP_FC_LAG0, SYS_LMP_FC_LAG1, SYS_LMP_FC_LAG2, SYS_LMP_BROADCAST_ENCRYPTION)

#define PRH_BS_CFG_SYS_LMP_SCATTER_MODE_FEATURE              0x0301
#define PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_FEATURE       0x0302
#define PRH_BS_CFG_SYS_LMP_EDR_ACL_3_MBPS_MODE_FEATURE       0x0304
#define PRH_BS_CFG_SYS_LMP_ENHANCED_INQUIRY_SCAN_FEATURE     0x0308
#define PRH_BS_CFG_SYS_LMP_INTERLACED_INQUIRY_SCAN_FEATURE   0x0310
#define PRH_BS_CFG_SYS_LMP_INTERLACED_PAGE_SCAN_FEATURE      0x0320
#define PRH_BS_CFG_SYS_LMP_RSSI_INQUIRY_RESULTS_FEATURE      0x0340
#define PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_FEATURE              0x0380

#define PRH_BS_CFG_BYTE_3_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_SCATTER_MODE, SYS_LMP_EDR_ACL_2_MBPS_MODE,\
        SYS_LMP_EDR_ACL_3_MBPS_MODE, SYS_LMP_ENHANCED_INQUIRY_SCAN, \
        SYS_LMP_INTERLACED_INQUIRY_SCAN, SYS_LMP_INTERLACED_PAGE_SCAN, \
        SYS_LMP_RSSI_INQUIRY_RESULTS, SYS_LMP_EXTENDED_SCO)

#define PRH_BS_CFG_SYS_LMP_EV4_PACKETS_FEATURE               0x0401
#define PRH_BS_CFG_SYS_LMP_EV5_PACKETS_FEATURE               0x0402
#define PRH_BS_CFG_SYS_LMP_ABSENCE_MASKS_FEATURE             0x0404
#define PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_SLAVE_FEATURE         0x0408
#define PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_SLAVE_FEATURE  0x0410
#define PRH_BS_CFG_SYS_LMP_ALIAS_AUTHENTICATION_FEATURE      0x0420
#define PRH_BS_CFG_SYS_LMP_ANONYMITY_MODE_FEATURE            0x0440
#define PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ACL_PACKETS_FEATURE    0x0480

#define PRH_BS_CFG_BYTE_4_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_EV4_PACKETS, SYS_LMP_EV5_PACKETS, \
        SYS_LMP_ABSENCE_MASKS, SYS_LMP_AFH_CAPABLE_SLAVE, \
        SYS_LMP_AFH_CLASSIFICATION_SLAVE, SYS_LMP_ALIAS_AUTHENTICATION, \
        SYS_LMP_ANONYMITY_MODE, SYS_LMP_3_SLOT_EDR_ACL_PACKETS)

#define PRH_BS_CFG_SYS_LMP_5_SLOT_EDR_ACL_PACKETS_FEATURE    0x0501
#define PRH_BS_CFG_SYS_LMP_SNIFF_SUBRATING_FEATURE           0x0502
#define PRH_BS_CFG_SYS_LMP_PAUSE_ENCRYPTION_FEATURE          0x0504
#define PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_MASTER_FEATURE        0x0508
#define PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_MASTER_FEATURE 0x0510
#define PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_FEATURE      0x0520
#define PRH_BS_CFG_SYS_LMP_EDR_ESCO_3_MBPS_MODE_FEATURE      0x0540
#define PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ESCO_PACKETS_FEATURE   0x0580

#define PRH_BS_CFG_BYTE_5_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_5_SLOT_EDR_ACL_PACKETS, SYS_LMP_SNIFF_SUBRATING, \
        SYS_LMP_PAUSE_ENCRYPTION, SYS_LMP_AFH_CAPABLE_MASTER, \
        SYS_LMP_AFH_CLASSIFICATION_MASTER, SYS_LMP_EDR_ESCO_2_MBPS_MODE, \
        SYS_LMP_EDR_ESCO_3_MBPS_MODE, SYS_LMP_3_SLOT_EDR_ESCO_PACKETS)

#define PRH_BS_CFG_SYS_LMP_EXTENDED_INQUIRY_RESPONSE_FEATURE            0x0601
#define PRH_BS_CFG_SYS_LMP_SECURE_SIMPLE_PAIRING_FEATURE                0x0608
#define PRH_BS_CFG_SYS_LMP_ENCAPSULATED_PDU_FEATURE                     0x0610
#define PRH_BS_CFG_SYS_LMP_ERRONEOUS_DATA_REPORTING_FEATURE             0x0620
#define PRH_BS_CFG_SYS_LMP_NONFLUSHABLE_PACKET_BOUNDARY_FLAG_FEATURE    0x0640

#define PRH_BS_CFG_BYTE_6_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_EXTENDED_INQUIRY_RESPONSE, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_LMP_SECURE_SIMPLE_PAIRING, \
        SYS_LMP_ENCAPSULATED_PDU, SYS_LMP_ERRONEOUS_DATA_REPORTING, \
        SYS_LMP_NONFLUSHABLE_PACKET_BOUNDARY_FLAG, SYS_UNDEFINED)

#define PRH_BS_CFG_SYS_LMP_LINK_SUPERVISION_TIMEOUT_CHANGED_EVENT_FEATURE        0x0701
#define PRH_BS_CFG_SYS_LMP_INQUIRY_RESPONSE_TX_POWER_LEVEL_FEATURE               0x0702
#define PRH_BS_CFG_SYS_LMP_ENHANCED_POWER_CONTROL_FEATURE                        0x0704
#define PRH_BS_CFG_SYS_LMP_EXTENDED_FEATURES_FEATURE                             0x0780

#define PRH_BS_CFG_BYTE_7_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_LINK_SUPERVISION_TIMEOUT_CHANGED_EVENT, SYS_LMP_INQUIRY_RESPONSE_TX_POWER_LEVEL, \
        SYS_LMP_ENHANCED_POWER_CONTROL, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_LMP_EXTENDED_FEATURES)

/*
 * Byte 0 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_THREE_SLOT_PKT_SUPPORTED         \
        mSYSfeatures_Check_Feature(SYS_LMP_THREE_SLOT_PKT, 0)
#define PRH_BS_CFG_SYS_LMP_FIVE_SLOT_PKT_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LMP_FIVE_SLOT_PKT, 0)
#define PRH_BS_CFG_SYS_LMP_ENCRYPTION_SUPPORTED             \
        mSYSfeatures_Check_Feature(SYS_LMP_ENCRYPTION, 0)
#define PRH_BS_CFG_SYS_LMP_SLOT_OFFSET_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_LMP_SLOT_OFFSET, 0)
#define PRH_BS_CFG_SYS_LMP_TIMING_INFO_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_LMP_TIMING_INFO, 0)
#define PRH_BS_CFG_SYS_LMP_MSS_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_LMP_MSS, 0)
#define PRH_BS_CFG_SYS_LMP_HOLD_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_HOLD, 0)
#define PRH_BS_CFG_SYS_LMP_SNIFF_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_LMP_SNIFF, 0)

/*
 * Byte 1 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_PARK_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_PARK, 1)
#define PRH_BS_CFG_SYS_LMP_RSSI_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_RSSI, 1)
#define PRH_BS_CFG_SYS_LMP_CHANNEL_DRIVEN_QUALITY_SUPPORTED \
        mSYSfeatures_Check_Feature(SYS_LMP_CHANNEL_DRIVEN_QUALITY, 1)
#define PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_LMP_SCO, 1)
#define PRH_BS_CFG_SYS_LMP_HV2_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_LMP_HV2, 1)
#define PRH_BS_CFG_SYS_LMP_HV3_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_LMP_HV3, 1)
#define PRH_BS_CFG_SYS_LMP_U_LAW_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_LMP_U_LAW, 1)
#define PRH_BS_CFG_SYS_LMP_A_LAW_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_LMP_A_LAW, 1)

/*
 * Byte 2 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_CVSD_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_CVSD, 2)
#define PRH_BS_CFG_SYS_LMP_OPTIONAL_PAGING_SUPPORTED        \
        mSYSfeatures_Check_Feature(SYS_LMP_OPTIONAL_PAGING, 2)
#define PRH_BS_CFG_SYS_LMP_POWER_CONTROL_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LMP_POWER_CONTROL, 2)
#define PRH_BS_CFG_SYS_LMP_TRANSPARENT_SCO_SUPPORTED        \
        mSYSfeatures_Check_Feature(SYS_LMP_TRANSPARENT_SCO, 2)
#define PRH_BS_CFG_SYS_LMP_FC_LAG0_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_FC_LAG0, 2)
#define PRH_BS_CFG_SYS_LMP_FC_LAG1_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_FC_LAG1, 2)
#define PRH_BS_CFG_SYS_LMP_FC_LAG2_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_FC_LAG2, 2)
#define PRH_BS_CFG_SYS_LMP_BROADCAST_ENCRYPTION_SUPPORTED   \
        mSYSfeatures_Check_Feature(SYS_LMP_BROADCAST_ENCRYPTION, 2)

/*
 * Byte 3 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_SCATTER_MODE_SUPPORTED                       \
        mSYSfeatures_Check_Feature(SYS_LMP_SCATTER_MODE, 3)
#define PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_EDR_ACL_2_MBPS_MODE, 3)
#define PRH_BS_CFG_SYS_LMP_EDR_ACL_3_MBPS_MODE_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_EDR_ACL_3_MBPS_MODE, 3)
#define PRH_BS_CFG_SYS_LMP_ENHANCED_INQUIRY_SCAN_SUPPORTED              \
        mSYSfeatures_Check_Feature(SYS_LMP_ENHANCED_INQUIRY_SCAN, 3)
#define PRH_BS_CFG_SYS_LMP_INTERLACED_INQUIRY_SCAN_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_LMP_INTERLACED_INQUIRY_SCAN, 3)
#define PRH_BS_CFG_SYS_LMP_INTERLACED_PAGE_SCAN_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LMP_INTERLACED_PAGE_SCAN, 3)
#define PRH_BS_CFG_SYS_LMP_RSSI_INQUIRY_RESULTS_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LMP_RSSI_INQUIRY_RESULTS, 3)
#define PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_SUPPORTED                       \
        mSYSfeatures_Check_Feature(SYS_LMP_EXTENDED_SCO, 3)

/*
 * Byte 4 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_EV4_PACKETS_SUPPORTED                        \
        mSYSfeatures_Check_Feature(SYS_LMP_EV4_PACKETS, 4)
#define PRH_BS_CFG_SYS_LMP_EV5_PACKETS_SUPPORTED                        \
        mSYSfeatures_Check_Feature(SYS_LMP_EV5_PACKETS, 4)
#define PRH_BS_CFG_SYS_LMP_ABSENCE_MASKS_SUPPORTED                      \
        mSYSfeatures_Check_Feature(SYS_LMP_ABSENCE_MASKS, 4)
#define PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_SLAVE_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_LMP_AFH_CAPABLE_SLAVE, 4)
#define PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_SLAVE_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_LMP_AFH_CLASSIFICATION_SLAVE, 4)
#define PRH_BS_CFG_SYS_LMP_ALIAS_AUTHENTICATION_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LMP_ALIAS_AUTHENTICATION, 4)
#define PRH_BS_CFG_SYS_LMP_ANONYMITY_MODE_SUPPORTED                     \
        mSYSfeatures_Check_Feature(SYS_LMP_ANONYMITY_MODE, 4)
#define PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ACL_PACKETS_SUPPORTED             \
        mSYSfeatures_Check_Feature(SYS_LMP_3_SLOT_EDR_ACL_PACKETS, 4)

/*
 * Byte 5 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_5_SLOT_EDR_ACL_PACKETS_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_LMP_5_SLOT_EDR_ACL_PACKETS, 5)
#define PRH_BS_CFG_SYS_LMP_SNIFF_SUBRATING_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_LMP_SNIFF_SUBRATING, 5)
#define PRH_BS_CFG_SYS_LMP_PAUSE_ENCRYPTION_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_PAUSE_ENCRYPTION, 5)
#define PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_MASTER_SUPPORTED                 \
        mSYSfeatures_Check_Feature(SYS_LMP_AFH_CAPABLE_MASTER, 5)
#define PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_MASTER_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LMP_AFH_CLASSIFICATION_MASTER, 5)
#define PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LMP_EDR_ESCO_2_MBPS_MODE, 5)
#define PRH_BS_CFG_SYS_LMP_EDR_ESCO_3_MBPS_MODE_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LMP_EDR_ESCO_3_MBPS_MODE, 5)
#define PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ESCO_PACKETS_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_LMP_3_SLOT_EDR_ESCO_PACKETS, 5)


/*
 * Byte 6 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_EXTENDED_INQUIRY_RESPONSE_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LMP_EXTENDED_INQUIRY_RESPONSE, 6)
#define PRH_BS_CFG_SYS_LMP_SECURE_SIMPLE_PAIRING_SUPPORTED              \
        mSYSfeatures_Check_Feature(SYS_LMP_SECURE_SIMPLE_PAIRING, 6)
#define PRH_BS_CFG_SYS_LMP_ENCAPSULATED_PDU_SUPPORTED                   \
        mSYSfeatures_Check_Feature(SYS_LMP_ENCAPSULATED_PDU, 6)
#define PRH_BS_CFG_SYS_LMP_ERRONEOUS_DATA_REPORTING_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_LMP_ERRONEOUS_DATA_REPORTING, 6)
#define PRH_BS_CFG_SYS_LMP_NONFLUSHABLE_PACKET_BOUNDARY_FLAG_SUPPORTED  \
        mSYSfeatures_Check_Feature(SYS_LMP_NONFLUSHABLE_PACKET_BOUNDARY_FLAG, 6)

/*
 * Byte 7 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_LINK_SUPERVISION_TIMEOUT_CHANGED_EVENT_SUPPORTED         \
        mSYSfeatures_Check_Feature(SYS_LMP_LINK_SUPERVISION_TIMEOUT_CHANGED_EVENT, 7)
#define PRH_BS_CFG_SYS_LMP_INQUIRY_RESPONSE_TX_POWER_LEVEL_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_LMP_INQUIRY_RESPONSE_TX_POWER_LEVEL, 7)
#define PRH_BS_CFG_SYS_LMP_ENHANCED_POWER_CONTROL_SUPPORTED                         \
        mSYSfeatures_Check_Feature(SYS_LMP_ENHANCED_POWER_CONTROL, 7)
#define PRH_BS_CFG_SYS_LMP_EXTENDED_FEATURES_SUPPORTED                              \
        mSYSfeatures_Check_Feature(SYS_LMP_EXTENDED_FEATURES, 7)

/*
 * Byte 8 of LMP Features
 */
#define PRH_BS_CFG_SYS_LMP_SECURE_SIMPLE_PAIRING_HOST_FEATURE               0x0801
#define PRH_BS_CFG_BYTE_8_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_LMP_SECURE_SIMPLE_PAIRING_HOST, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED)

/*
 * Byte 8 of Features (Byte 0 of extended features)
 */
#define PRH_BS_CFG_SYS_LMP_SECURE_SIMPLE_PAIRING_HOST_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LMP_SECURE_SIMPLE_PAIRING_HOST, 8)



/***********************************************************************
 * Parthus Features (extensions similar Bluetooth LMP features)
 *
 ***********************************************************************/
/*
 * PARTHUS Feature definition 0xBBbb   BB byte position, bb bit position
 */

#define PRH_BS_CFG_SYS_FILTERS_FEATURE                      0x1001
#define PRH_BS_CFG_SYS_HC_TO_HOST_FLOW_CONTROL_FEATURE      0x1002
#define PRH_BS_CFG_SYS_LINK_KEY_DATABASE_FEATURE            0x1004
#define PRH_BS_CFG_SYS_REMOTE_NAME_REQUEST_FEATURE          0x1008
#define PRH_BS_CFG_SYS_LOOPBACK_VIA_HCI_FEATURE             0x1010
#define PRH_BS_CFG_SYS_FLUSH_FEATURE                        0x1020
#define PRH_BS_CFG_SYS_PICONET_FEATURE                      0x1040
#define PRH_BS_CFG_SYS_SCATTERNET_FEATURE                   0x1080

#define PRH_BS_CFG_BYTE_16_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_FILTERS, SYS_HC_TO_HOST_FLOW_CONTROL, SYS_LINK_KEY_DATABASE, SYS_REMOTE_NAME_REQUEST, \
        SYS_LOOPBACK_VIA_HCI, SYS_FLUSH, SYS_PICONET, SYS_SCATTERNET)

#define PRH_BS_CFG_SYS_MODIFY_TIMERS_FEATURE                0x1101
#define PRH_BS_CFG_SYS_TEST_MODE_FEATURE                    0x1102
#define PRH_BS_CFG_SYS_CHANGE_LOCAL_NAME_FEATURE            0x1104
#define PRH_BS_CFG_SYS_MODIFY_LOCAL_FEATURES_FEATURE        0x1108
#define PRH_BS_CFG_SYS_TEST_MODE_TESTER_FEATURE             0x1110
#define PRH_BS_CFG_SYS_NEGOTIATED_HOLD_FEATURE              0x1120
#define PRH_BS_CFG_SYS_DATA_PUMP_FEATURE                    0x1140
#define PRH_BS_CFG_SYS_HOP_MODE_EUROPE_USA_ONLY_FEATURE     0x1180

#define PRH_BS_CFG_BYTE_17_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_MODIFY_TIMERS, SYS_TEST_MODE, SYS_CHANGE_LOCAL_NAME, SYS_MODIFY_LOCAL_FEATURES, \
        SYS_TEST_MODE_TESTER, SYS_NEGOTIATED_HOLD, SYS_DATA_PUMP, SYS_HOP_MODE_EUROPE_USA_ONLY)

#define PRH_BS_CFG_SYS_WRITE_SCAN_ACTIVITY_FEATURE          0x1201
#define PRH_BS_CFG_SYS_PAGE_FEATURE                         0x1202
#define PRH_BS_CFG_SYS_PAGE_SCAN_FEATURE                    0x1204
#define PRH_BS_CFG_SYS_INQUIRY_FEATURE                      0x1208
#define PRH_BS_CFG_SYS_INQUIRY_SCAN_FEATURE                 0x1210
#define PRH_BS_CFG_SYS_INQUIRY_READ_WRITE_IAC_LAP_FEATURE   0x1220
#define PRH_BS_CFG_SYS_INQUIRY_UNIQUE_RESULTS_FEATURE       0x1240
#define PRH_BS_CFG_SYS_INQUIRY_PERIODIC_FEATURE             0x1280

#define PRH_BS_CFG_BYTE_18_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_WRITE_SCAN_ACTIVITY, SYS_PAGE, SYS_PAGE_SCAN, SYS_INQUIRY, SYS_INQUIRY_SCAN, \
        SYS_INQUIRY_READ_WRITE_IAC_LAP, SYS_INQUIRY_UNIQUE_RESULTS, SYS_INQUIRY_PERIODIC)

#define PRH_BS_CFG_SYS_QOS_FEATURE                          0x1301
#define PRH_BS_CFG_SYS_FLOW_SPECIFICATION_FEATURE           0x1302
#define PRH_BS_CFG_SYS_CHANGE_ACL_PACKET_TYPE_FEATURE       0x1304
#define PRH_BS_CFG_SYS_CHANGE_SCO_PACKET_TYPE_FEATURE       0x1308
#define PRH_BS_CFG_SYS_LM_AUTO_RATE_FEATURE                 0x1310
#define PRH_BS_CFG_SYS_LM_PREFERRED_RATE_FEATURE            0x1320
#define PRH_BS_CFG_SYS_SYN_VIA_HCI_FEATURE                  0x1340
#define PRH_BS_CFG_SYS_SYN_VIA_ACL_FEATURE                  0x1380

#define PRH_BS_CFG_BYTE_19_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_QOS, SYS_FLOW_SPECIFICATION, SYS_CHANGE_ACL_PACKET_TYPE, SYS_CHANGE_SCO_PACKET_TYPE, \
        SYS_LM_AUTO_RATE, SYS_LM_PREFERRED_RATE, SYS_SYN_VIA_HCI, SYS_SYN_VIA_ACL)

#define PRH_BS_CFG_SYS_TRACE_LMP_VIA_HCI_FEATURE            0x1401
#define PRH_BS_CFG_SYS_TRACE_LC_VIA_HCI_FEATURE             0x1402
#define PRH_BS_CFG_SYS_TRACE_BB_VIA_HCI_FEATURE             0x1404
#define PRH_BS_CFG_SYS_TRACE_RADIO_VIA_HCI_FEATURE          0x1408
#define PRH_BS_CFG_SYS_TRACE_INTR_VIA_HCI_FEATURE           0x1410
#define PRH_BS_CFG_SYS_TRACE_BB_IDLE_VIA_HCI_FEATURE        0x1420
#define PRH_BS_CFG_SYS_TRACE_DEBUG_VIA_UART_FEATURE         0x1440

#define PRH_BS_CFG_BYTE_20_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_TRACE_LMP_VIA_HCI, SYS_TRACE_LC_VIA_HCI, SYS_TRACE_BB_VIA_HCI, \
        SYS_TRACE_RADIO_VIA_HCI, SYS_TRACE_INTR_VIA_HCI, \
        SYS_TRACE_BB_IDLE_VIA_HCI, SYS_TRACE_DEBUG_VIA_UART, SYS_UNDEFINED)

#define PRH_BS_CFG_SYS_FAST_INQUIRY_RESPONSE_FEATURE            0x1501
#define PRH_BS_CFG_SYS_FORCE_SINGLE_SLOT_R2P_FEATURE            0x1502
#define PRH_BS_CFG_SYS_EXTENDED_HCI_COMMANDS_FEATURE            0x1504
#define PRH_BS_CFG_SYS_NAK_DUPLICATES_IF_CRC_FEATURE            0x1508
#define PRH_BS_CFG_SYS_AUTOMATIC_R2P_FEATURE                    0x1510
#define PRH_BS_CFG_SYS_BROADCAST_NULL_IN_INQ_PAGE_FEATURE       0x1520
#define PRH_BS_CFG_SYS_PERSISTENT_SCO_IN_SCANS_FEATURE          0x1540
#define PRH_BS_CFG_SYS_HW_HOP_SELECTION_ENGINE_FEATURE          0x1580

#define PRH_BS_CFG_BYTE_21_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_FAST_INQUIRY_RESPONSE, SYS_FORCE_SINGLE_SLOT_R2P, SYS_EXTENDED_HCI_COMMANDS, \
        SYS_NAK_DUPLICATES_IF_CRC, SYS_AUTOMATIC_R2P, SYS_BROADCAST_NULL_IN_INQ_PAGE, \
        SYS_PERSISTENT_SCO_IN_SCANS, SYS_HW_HOP_SELECTION_ENGINE)

#define PRH_BS_CFG_SYS_V12_FUNCTIONALITY_FEATURE                0x1601
#define PRH_BS_CFG_SYS_HCI_READ_CLOCK_FEATURE                   0x1602
#define PRH_BS_CFG_SYS_CHANNEL_ASSESSMENT_SCHEME_FEATURE        0x1604
#define PRH_BS_CFG_SYS_EXTRA_SYN_LINKS_FEATURE                  0x1608
#define PRH_BS_CFG_SYS_SCO_REPEATER_FEATURE                     0x1610
#define PRH_BS_CFG_SYS_ESCO_SHARED_RETRANSMISSION_FEATURE       0x1620
#define PRH_BS_CFG_SYS_DISABLE_HCI_FEATURE                      0x1640
#define PRH_BS_CFG_SYS_RESPONSE_REQUEST_EVENT_FEATURE           0x1680

#define PRH_BS_CFG_BYTE_22_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_V12_FUNCTIONALITY, SYS_HCI_READ_CLOCK, \
        SYS_CHANNEL_ASSESSMENT_SCHEME, SYS_EXTRA_SYN_LINKS, \
        SYS_SCO_REPEATER, SYS_ESCO_SHARED_RETRANSMISSION, \
        SYS_DISABLE_HCI, SYS_RESPONSE_REQUEST_EVENT)

#define PRH_BS_CFG_SYS_SCO_AUTO_RATE_FEATURE                 0x1701

#define PRH_BS_CFG_BYTE_23_DESCRIPTION  mSYSfeatures_Extract_Feature_Combined_Byte( \
        SYS_SCO_AUTO_RATE, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED, \
        SYS_UNDEFINED, SYS_UNDEFINED)

/*
 * Byte 16 of Features (Byte 0 of Parthus SUPPORTEDs)
 *
 * Either build from this file definitions or extract from external compiler definitions
 */
#define PRH_BS_CFG_SYS_FILTERS_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_FILTERS, 16)
#define PRH_BS_CFG_SYS_HC_TO_HOST_FLOW_CONTROL_SUPPORTED    \
        mSYSfeatures_Check_Feature(SYS_HC_TO_HOST_FLOW_CONTROL, 16)
#define PRH_BS_CFG_SYS_LINK_KEY_DATABASE_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LINK_KEY_DATABASE, 16)
#define PRH_BS_CFG_SYS_REMOTE_NAME_REQUEST_SUPPORTED        \
        mSYSfeatures_Check_Feature(SYS_REMOTE_NAME_REQUEST, 16)
#define PRH_BS_CFG_SYS_LOOPBACK_VIA_HCI_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_LOOPBACK_VIA_HCI, 16)
#define PRH_BS_CFG_SYS_FLUSH_SUPPORTED                      \
        mSYSfeatures_Check_Feature(SYS_FLUSH, 16)
#define PRH_BS_CFG_SYS_PICONET_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_PICONET, 16)
#define PRH_BS_CFG_SYS_SCATTERNET_SUPPORTED                 \
        mSYSfeatures_Check_Feature(SYS_SCATTERNET, 16)

/*
 * Byte 17 of Features (Byte 1 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_MODIFY_TIMERS_SUPPORTED              \
        mSYSfeatures_Check_Feature(SYS_MODIFY_TIMERS, 17)
#define PRH_BS_CFG_SYS_CHANGE_LOCAL_NAME_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_CHANGE_LOCAL_NAME, 17)
#define PRH_BS_CFG_SYS_MODIFY_LOCAL_FEATURES_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_MODIFY_LOCAL_FEATURES, 17)

#define PRH_BS_CFG_SYS_TEST_MODE_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_TEST_MODE, 17)
#define PRH_BS_CFG_SYS_TEST_MODE_TESTER_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_TEST_MODE_TESTER, 17)
#define PRH_BS_CFG_SYS_NEGOTIATED_HOLD_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_NEGOTIATED_HOLD, 17)
#define PRH_BS_CFG_SYS_DATA_PUMP_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_DATA_PUMP, 17)
#define PRH_BS_CFG_SYS_HOP_MODE_EUROPE_USA_ONLY_SUPPORTED   \
        mSYSfeatures_Check_Feature(SYS_HOP_MODE_EUROPE_USA_ONLY, 17)

/*
 * Byte 18 of Features (Byte 2 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_WRITE_SCAN_ACTIVITY_SUPPORTED        \
        mSYSfeatures_Check_Feature(SYS_WRITE_SCAN_ACTIVITY, 18)
#define PRH_BS_CFG_SYS_PAGE_SUPPORTED                       \
        mSYSfeatures_Check_Feature(SYS_PAGE, 18)
#define PRH_BS_CFG_SYS_PAGE_SCAN_SUPPORTED                  \
        mSYSfeatures_Check_Feature(SYS_PAGE_SCAN, 18)
#define PRH_BS_CFG_SYS_INQUIRY_SUPPORTED                    \
        mSYSfeatures_Check_Feature(SYS_INQUIRY, 18)
#define PRH_BS_CFG_SYS_INQUIRY_SCAN_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_INQUIRY_SCAN, 18)
#define PRH_BS_CFG_SYS_INQUIRY_READ_WRITE_IAC_LAP_SUPPORTED \
        mSYSfeatures_Check_Feature(SYS_INQUIRY_READ_WRITE_IAC_LAP, 18)
#define PRH_BS_CFG_SYS_INQUIRY_UNIQUE_RESULTS_SUPPORTED     \
        mSYSfeatures_Check_Feature(SYS_INQUIRY_UNIQUE_RESULTS, 18)
#define PRH_BS_CFG_SYS_INQUIRY_PERIODIC_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_INQUIRY_PERIODIC, 18)

/*
 * Number_Of_Supported_IACs (if no Read/Write then 1 else if not defined then 4)
 */
#if (PRH_BS_CFG_SYS_INQUIRY_READ_WRITE_IAC_LAP_SUPPORTED==0)
#define PRH_BS_CFG_SYS_NUMBER_OF_SUPPORTED_IAC      1
#elif !defined(PRH_BS_CFG_SYS_NUMBER_OF_SUPPORTED_IAC)
#define PRH_BS_CFG_SYS_NUMBER_OF_SUPPORTED_IAC      4
#endif

/*
 * Byte 19 of Features (Byte 3 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_QOS_SUPPORTED                        \
        mSYSfeatures_Check_Feature(SYS_QOS, 19)
#define PRH_BS_CFG_SYS_FLOW_SPECIFICATION_SUPPORTED         \
        mSYSfeatures_Check_Feature(SYS_FLOW_SPECIFICATION, 19)
#define PRH_BS_CFG_SYS_CHANGE_ACL_PACKET_TYPE_SUPPORTED     \
        mSYSfeatures_Check_Feature(SYS_CHANGE_ACL_PACKET_TYPE, 19)
#define PRH_BS_CFG_SYS_CHANGE_SCO_PACKET_TYPE_SUPPORTED     \
        mSYSfeatures_Check_Feature(SYS_CHANGE_SCO_PACKET_TYPE, 19)
#define PRH_BS_CFG_SYS_LM_AUTO_RATE_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_LM_AUTO_RATE, 19)
#define PRH_BS_CFG_SYS_LM_PREFERRED_RATE_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_LM_PREFERRED_RATE, 19)
#define PRH_BS_CFG_SYS_SYN_VIA_HCI_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_SYN_VIA_HCI, 19)
#define PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_SYN_VIA_ACL, 19)

/*
 * Byte 20 of Features (Byte 4 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_TRACE_LMP_VIA_HCI_SUPPORTED          \
        mSYSfeatures_Check_Feature(SYS_TRACE_LMP_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_LC_VIA_HCI_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_TRACE_LC_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_BB_VIA_HCI_SUPPORTED           \
        mSYSfeatures_Check_Feature(SYS_TRACE_BB_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_INTR_VIA_HCI_SUPPORTED         \
        mSYSfeatures_Check_Feature(SYS_TRACE_INTR_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_RADIO_VIA_HCI_SUPPORTED        \
        mSYSfeatures_Check_Feature(SYS_TRACE_RADIO_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_BB_IDLE_VIA_HCI_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_TRACE_BB_IDLE_VIA_HCI, 20)
#define PRH_BS_CFG_SYS_TRACE_DEBUG_VIA_UART_SUPPORTED       \
        mSYSfeatures_Check_Feature(SYS_TRACE_DEBUG_VIA_UART, 20)

/*
 * Byte 21 of Features (Byte 5 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_FAST_INQUIRY_RESPONSE_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_FAST_INQUIRY_RESPONSE, 21)
#define PRH_BS_CFG_SYS_FORCE_SINGLE_SLOT_R2P_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_FORCE_SINGLE_SLOT_R2P, 21)
#define PRH_BS_CFG_SYS_EXTENDED_HCI_COMMANDS_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_EXTENDED_HCI_COMMANDS, 21)
#define PRH_BS_CFG_SYS_NAK_DUPLICATES_IF_CRC_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_NAK_DUPLICATES_IF_CRC, 21)
#define PRH_BS_CFG_SYS_AUTOMATIC_R2P_SUPPORTED              \
        mSYSfeatures_Check_Feature(SYS_AUTOMATIC_R2P, 21)
#define PRH_BS_CFG_SYS_BROADCAST_NULL_IN_INQ_PAGE_SUPPORTED \
        mSYSfeatures_Check_Feature(SYS_BROADCAST_NULL_IN_INQ_PAGE, 21)
#define PRH_BS_CFG_SYS_PERSISTENT_SCO_IN_SCANS_SUPPORTED    \
        mSYSfeatures_Check_Feature(SYS_PERSISTENT_SCO_IN_SCANS, 21)
#define PRH_BS_CFG_SYS_HW_HOP_SELECTION_ENGINE_SUPPORTED    \
        mSYSfeatures_Check_Feature(SYS_HW_HOP_SELECTION_ENGINE, 21)

/*
 * Byte 22 of Features (Byte 6 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_HCI_V12_FUNCTIONALITY_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_V12_FUNCTIONALITY, 22)
#define PRH_BS_CFG_SYS_HCI_READ_CLOCK_SUPPORTED             \
        mSYSfeatures_Check_Feature(SYS_HCI_READ_CLOCK, 22)
#define PRH_BS_CFG_SYS_CHANNEL_ASSESSMENT_SCHEME_SUPPORTED  \
        mSYSfeatures_Check_Feature(SYS_CHANNEL_ASSESSMENT_SCHEME, 22)
#define PRH_BS_CFG_SYS_EXTRA_SYN_LINKS_SUPPORTED            \
        mSYSfeatures_Check_Feature(SYS_EXTRA_SYN_LINKS, 22)
#define PRH_BS_CFG_SYS_SCO_REPEATER_SUPPORTED               \
        mSYSfeatures_Check_Feature(SYS_SCO_REPEATER, 22)
#define PRH_BS_CFG_SYS_ESCO_SHARED_RETRANSMISSION_SUPPORTED \
        mSYSfeatures_Check_Feature(SYS_ESCO_SHARED_RETRANSMISSION, 22)
#define PRH_BS_CFG_SYS_DISABLE_HCI_SUPPORTED                \
        mSYSfeatures_Check_Feature(SYS_DISABLE_HCI, 22)
#define PRH_BS_CFG_SYS_RESPONSE_REQUEST_EVENT_SUPPORTED     \
        mSYSfeatures_Check_Feature(SYS_RESPONSE_REQUEST_EVENT, 22)

/*
 * Byte 23 of Features (Byte 6 of Parthus SUPPORTEDs)
 */
#define PRH_BS_CFG_SYS_SCO_AUTO_RATE_SUPPORTED      \
        mSYSfeatures_Check_Feature(SYS_SCO_AUTO_RATE, 23)


#ifndef PRH_BS_CFG_SYS_MAX_FILTERS
#define PRH_BS_CFG_SYS_MAX_FILTERS                  10
#endif

#ifndef PRH_BS_CFG_SYS_MAX_STORED_LINK_KEYS
#define PRH_BS_CFG_SYS_MAX_STORED_LINK_KEYS        5 //10
#endif

/*
 * Derived Features not included in features bytes above
 */
#define PRH_BS_CFG_SYS_RETURN_TO_PICONET_SUPPORTED          \
        (PRH_BS_CFG_SYS_LMP_HOLD_SUPPORTED ||               \
         PRH_BS_CFG_SYS_LMP_SNIFF_SUPPORTED ||              \
         PRH_BS_CFG_SYS_LMP_PARK_SUPPORTED)

#define PRH_BS_CFG_SYS_LMP_FC_LAG_SUPPORTED                 \
        (PRH_BS_CFG_SYS_LMP_FC_LAG0_SUPPORTED |             \
        (PRH_BS_CFG_SYS_LMP_FC_LAG1_SUPPORTED <<1) |        \
        (PRH_BS_CFG_SYS_LMP_FC_LAG2_SUPPORTED <<2) )

#define PRH_BS_CFG_SYS_TRACE_VIA_HCI_SUPPORTED              \
       (PRH_BS_CFG_SYS_TRACE_LC_VIA_HCI_SUPPORTED ||        \
        PRH_BS_CFG_SYS_TRACE_BB_VIA_HCI_SUPPORTED ||        \
        PRH_BS_CFG_SYS_TRACE_INTR_VIA_HCI_SUPPORTED ||      \
        PRH_BS_CFG_SYS_TRACE_RADIO_VIA_HCI_SUPPORTED ||     \
        (BUILD_TYPE==UNIT_TEST_BUILD)    )

#define PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_SUPPORTED            \
       (PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_MASTER_SUPPORTED ||  \
        PRH_BS_CFG_SYS_LMP_AFH_CAPABLE_SLAVE_SUPPORTED)

#define PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_SUPPORTED            \
       (PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_MASTER_SUPPORTED ||  \
        PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_SLAVE_SUPPORTED)

#define PRH_BS_CFG_SYS_SYNCHRONOUS_CONNECTIONS_SUPPORTED \
        (PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_SUPPORTED ||    \
         PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED)

#define PRH_BS_CFG_SYS_SCO_QUALITY_SUPPORT              \
        (PRH_BS_CFG_SYS_SCO_AUTO_RATE_SUPPORTED ||      \
        PRH_BS_CFG_SYS_LMP_ERRONEOUS_DATA_REPORTING_SUPPORTED)

/*
 * Buffer sizes for generic build allocated dynamically for flexible
 * data queue sizes on generic lib initialisation.
 */

#if (COMBINED_HOST==1)
#define PRH_BS_CFG_SYS_FLEXIBLE_DATA_BUFFER_SIZES_SUPPORTED   0
#else
#define PRH_BS_CFG_SYS_FLEXIBLE_DATA_BUFFER_SIZES_SUPPORTED   1
        //(BUILD_TYPE==GENERIC_BUILD)
#endif

/*
 * Propretary implementation to add 4 bit seqeunce code to HCI SCO data
 * to support detection of sco packet loss in apps/host.
 */
#define PRH_BS_CFG_SYS_SCO_VIA_HCI_SEQN_SUPPORTED 0


/*
 * Checks for feature selection dependencies
 */
#if (PRH_BS_CFG_SYS_LMP_POWER_CONTROL_SUPPORTED==1) && \
    (PRH_BS_CFG_SYS_LMP_RSSI_SUPPORTED==0)
#error LMP_POWER_CONTROL requires LMP_RSSI to be supported
#endif

#if (PRH_BS_CFG_SYS_SYN_VIA_HCI_SUPPORTED==1) && \
    ((PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)|| \
    (PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED==0))
#error SCO_VIA_HCI requires SCO Support
#endif

#if (PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED==1) && \
    (PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)
#error SCO_VIA_ACL requires SCO Support
#endif

#if (PRH_BS_CFG_SYS_SCO_AUTO_RATE_SUPPORTED==1) && \
    (PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)
#error SCO_AUTO_RATE requires SCO Support
#endif

#if (PRH_BS_CFG_SYS_CHANGE_SCO_PACKET_TYPE_SUPPORTED==1) && \
    (PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)
#error Change SCO packet type requires SCO support.
#endif

#if (PRH_BS_CFG_SYS_LMP_HV2_SUPPORTED || PRH_BS_CFG_SYS_LMP_HV3_SUPPORTED) && \
    (PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)
#error SCO_required if LMP_HV2 OR LMP_HV3 supported.
#endif

#if (PRH_BS_CFG_SYS_TEST_MODE_TESTER_SUPPORTED) && \
    ((PRH_BS_CFG_SYS_TEST_MODE_SUPPORTED==0) || \
     (PRH_BS_CFG_SYS_EXTENDED_HCI_COMMANDS_SUPPORTED==0))
#error TEST_MODE and EXTENDED_HCI_COMMANDS required if TEST_MODE_TESTER supported
#endif

#if (PRH_BS_CFG_SYS_HCI_V12_FUNCTIONALITY_SUPPORTED==0) && \
    (PRH_BS_CFG_SYS_LMP_AFH_CLASSIFICATION_SUPPORTED)
#error SYS_HCI_V12_FUNCTIONALITY required if AFH CLASSIFICATION supported
#endif

#if (PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED==0) && \
    (PRH_BS_CFG_SYS_LMP_EDR_ACL_3_MBPS_MODE_SUPPORTED)
#error SYS_LMP_EDR_ACL_2_MBPS_MODE required if  SYS_LMP_EDR_ACL_3_MBPS_MODE supported
#endif

#if (PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED==0) && \
    (PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ACL_PACKETS_SUPPORTED)
#error SYS_LMP_EDR_ACL_2_MBPS_MODE required if  SYS_LMP_3_SLOT_EDR_ACL_PACKETS supported
#endif

#if (PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED==0) && \
    (PRH_BS_CFG_SYS_LMP_5_SLOT_EDR_ACL_PACKETS_SUPPORTED)
#error SYS_LMP_EDR_ACL_2_MBPS_MODE required if  SYS_LMP_5_SLOT_EDR_ACL_PACKETS supported
#endif

#if (PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_SUPPORTED==0) && \
  (PRH_BS_CFG_SYS_LMP_EDR_ESCO_3_MBPS_MODE_SUPPORTED)
#error SYS_LMP_EDR_ESCO_2_MBPS_MODE required if SYS_LMP_EDR_ESCO_3_MBPS_MODE supported
#endif

#if ((PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_SUPPORTED==0) && \
    (PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ESCO_PACKETS_SUPPORTED==1))
#error SYS_LMP_EDR_ESCO_2_MBPS_MODE required if SYS_LMP_3_SLOT_EDR_ESCO_PACKETS supported
#endif
/* for features of 2.1 */
#if (!PRH_BS_CFG_SYS_SYNCHRONOUS_CONNECTIONS_SUPPORTED && \
    PRH_BS_CFG_SYS_LMP_ERRONEOUS_DATA_REPORTING_SUPPORTED)
#error "Erroneous Data Reporting" feature bit may be set if at least one of the "SCO link" or "Extended SCO link" feature bits are set.
#endif

#if(PRH_BS_CFG_SYS_LMP_SNIFF_SUBRATING_SUPPORTED && \
    !PRH_BS_CFG_SYS_LMP_SNIFF_SUPPORTED)
#error "Sniff subrating" shall be set if the "Sniff mode" feature bit is set.
#endif

#if(PRH_BS_CFG_SYS_LMP_EXTENDED_INQUIRY_RESPONSE_SUPPORTED && \
    !PRH_BS_CFG_SYS_LMP_RSSI_INQUIRY_RESULTS_SUPPORTED )
#error If "Extended Inquiry Response" is support, the "RSSI with inquiry results" feature bit shall also be set.
#endif
#if( PRH_BS_CFG_SYS_LMP_SECURE_SIMPLE_PAIRING_SUPPORTED && \
    !PRH_BS_CFG_SYS_LMP_ENCAPSULATED_PDU_SUPPORTED)
#error Encapsulated PDU shall be support if Secure Simple Pairing is supported.
#endif
/* for fratures of 3.0 */
#if (PRH_BS_CFG_SYS_LMP_ENHANCED_POWER_CONTROL_SUPPORTED==1) && \
    (PRH_BS_CFG_SYS_LMP_POWER_CONTROL_SUPPORTED==0)
#error LMP_ENHANCED_POWER_CONTROL requires LMP_POWER_CONTROL to be supported
#endif


/*
 * SCO support and T_SERIES HARDWARE ARE BOTH
 * required for eSCO feature.
 */
#if(PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_SUPPORTED==1)

#if(PRH_BS_CFG_SYS_LMP_SCO_SUPPORTED==0)
#error SCO FUNCTIONALITY required if EXTENDED SCO supported
#endif

#if(PRH_BS_CFG_TABASCO_VERSION < PRH_BS_HW_TABASCO_VERSION_T1_0_0)
#if (BUILD_TYPE==UNIT_TEST_BUILD)
    #undef PRH_BS_CFG_TABASCO_VERSION
    #define PRH_BS_CFG_TABASCO_VERSION PRH_BS_HW_TABASCO_VERSION_T1_0_0
#else
    #error T-SERIES HARDWARE required if EXTENDED SCO supported
#endif
#endif

#endif

#if ((PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED==1)||  \
    (PRH_BS_CFG_SYS_SYN_VIA_HCI_SUPPORTED == 1))
    #define PRH_DEV_QUEUE_SIZE_SMALL
#endif

#define PRH_DEV_QUEUE_MERGE_L2CAP
#if COMBINED_HOST==1
/* add for a2dp */
#if (RDA_PRODUCT&RDA_STEREO_HEADSET)
#define PRH_BS_CFG_SYS_A2DP_QUEUE_SUPPORT               1
#define HCIT_RDA5868_DMA_ENABLE                         1
#else
#define PRH_BS_CFG_SYS_A2DP_QUEUE_SUPPORT               1
#define HCIT_RDA5868_DMA_ENABLE                         1
#endif
#else
#define PRH_BS_CFG_SYS_A2DP_QUEUE_SUPPORT               0
#if (BUILD_TYPE==UNIT_TEST_BUILD)
#define HCIT_RDA5868_DMA_ENABLE             0
#else
#define HCIT_RDA5868_DMA_ENABLE             1
#endif
#endif //COMBINED_HOST==1

//#if(RDA_PRODUCT&RDA_STEREO_HEADSET)
#define DEFAULT_L2CAP_IN_MTU          800+4 //(672+4)
//#else
//#define DEFAULT_L2CAP_IN_MTU         (60+4) // = RDABT_L2_MAX_MTU in platform_config.h
//#endif
#define DEFAULT_L2CAP_OUT_MTU         (60+4)

/*
 * Major configuration parameters for Queues
 *
 * Please note:
 * 1. ACL_IN_PACKET_LENGTH and ACL_OUT_PACKET_LENGTH will be aligned
 *    to ensure that PRH_BS_CFG_SYS_ACL_BUFFER_ALIGNMENT due to buffer
 *    alignment constraints
 *    IN:  Radio Baseband to Host        OUT: Host to Radio Baseband
 * 2. The PRH_BS_CFG_SYS_ACL_SEGMENT_LENGTH_ALIGNMENT must be 1, 2 or 4 bytes
 *    and determines what the segment alignment for each segmented packet.
 *    Penalty is time required for tx queue-> baseband copy.
 */
#if HCIT_RDA5868_DMA_ENABLE
#define PRH_BS_CFG_SYS_ACL_BUFFER_ALIGNMENT             4     /* Bytes  */
#else
#define PRH_BS_CFG_SYS_ACL_BUFFER_ALIGNMENT             16    /* Bytes  */
#endif
#define PRH_BS_CFG_SYS_ACL_SEGMENT_LENGTH_ALIGNMENT     4     /* Bytes */

#if (COMBINED_HOST==1)
#if(PRH_BS_CFG_SYS_A2DP_QUEUE_SUPPORT == 1)
    #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH         DEFAULT_L2CAP_IN_MTU   /* Bytes  */
    #define PRH_BS_CFG_SYS_A2DP_IN_PACKET_LENGTH        PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH   /* Bytes  */
    #define PRH_BS_CFG_SYS_NUM_IN_A2DP_PACKETS          3    /* Buffers*/
#else
    #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH         DEFAULT_L2CAP_IN_MTU       /* Bytes  */
#endif
    #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH        DEFAULT_L2CAP_OUT_MTU       /* Bytes  */

#elif (PRH_BS_CFG_SYS_LMP_EDR_ACL_3_MBPS_MODE_SUPPORTED==1)
    #if (PRH_BS_CFG_SYS_LMP_5_SLOT_EDR_ACL_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH    (MAX__3DH5_USER_PDU)         /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH   (MAX__3DH5_USER_PDU)         /* Bytes  */
    #elif (PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ACL_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH     MAX__3DH3_USER_PDU   /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH    MAX__3DH3_USER_PDU   /* Bytes  */
    #else
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH     MAX__3DH1_USER_PDU        /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH    MAX__3DH1_USER_PDU        /* Bytes  */
    #endif

#elif (PRH_BS_CFG_SYS_LMP_EDR_ACL_2_MBPS_MODE_SUPPORTED==1)
    #if (PRH_BS_CFG_SYS_LMP_5_SLOT_EDR_ACL_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH    (MAX__2DH5_USER_PDU)         /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH   (MAX__2DH5_USER_PDU)         /* Bytes  */
    #elif (PRH_BS_CFG_SYS_LMP_3_SLOT_EDR_ACL_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH     MAX__2DH3_USER_PDU   /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH    MAX__2DH3_USER_PDU   /* Bytes  */
    #else
        #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH     MAX__2DH1_USER_PDU        /* Bytes  */
        #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH    MAX__2DH1_USER_PDU        /* Bytes  */
    #endif

#else

#if (PRH_BS_CFG_SYS_LMP_FIVE_SLOT_PKT_SUPPORTED==1)
    #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH         MAX_DH5_USER_PDU        /* Bytes  */
    #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH    MAX_DH5_USER_PDU        /* Bytes  */
#elif (PRH_BS_CFG_SYS_LMP_THREE_SLOT_PKT_SUPPORTED==1)
    #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH         MAX_DH3_USER_PDU    /* Bytes  */
    #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH        MAX_DH3_USER_PDU    /* Bytes  */
#else
    #define PRH_BS_CFG_SYS_ACL_IN_PACKET_LENGTH         MIN_L2CAP_MTU       /* Bytes  */
    #define PRH_BS_CFG_SYS_ACL_OUT_PACKET_LENGTH        MIN_L2CAP_MTU       /* Bytes  */
#endif

#endif

/* Allows the minimum acceptable Sniff Attempt value to be defined @ build time */
#ifndef PRH_BS_CFG_SYS_LMP_MIN_SNIFF_ATTEMPT
    #if (PRH_BS_CFG_TABASCO_VERSION <= PRH_BS_HW_TABASCO_VERSION_P7_5_0)
        #define PRH_BS_CFG_SYS_LMP_MIN_SNIFF_ATTEMPT    2
    #else
        #define PRH_BS_CFG_SYS_LMP_MIN_SNIFF_ATTEMPT    1
    #endif
#endif
#define PRH_BS_CFG_SYS_LMP_MAX_SNIFF_ATTEMPT                        0x7FFF
#define PRH_BS_CFG_SYS_LMP_MAX_SNIFF_TIMEOUT                        0x7FFF
#define PRH_BS_CFG_SYS_LMP_MAX_SNIFF_INTERVAL                       0xFFFF
#define PRH_BS_CFG_SYS_LMP_MIN_SNIFF_INTERVAL                       4

#if (PRH_BS_CFG_SYS_PICONET_SUPPORTED == 1)
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_COMMAND_HEAP                  0x200 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_COMMANDS                         8
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_EVENT_HEAP                    0x300 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_EVENTS                           8
    #define PRH_BS_CFG_SYS_SIZEOF_LMP_IN_HEAP                       0x50  /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_LMP_IN_MESSAGES                      8

    #define PRH_BS_CFG_SYS_LMP_OUT_PACKET_LENGTH               0x11  /* Bytes  */
    #define PRH_BS_CFG_SYS_NUM_LMP_OUT_PACKETS                     20

    #define PRH_BS_CFG_SYS_NUM_IN_ACL_PACKETS               6    /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_ACL_PACKETS              8    /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_IN_SCO_PACKETS               8    /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_SCO_PACKETS              8    /* Buffers*/

    #if(PRH_BS_CFG_SYS_LMP_EDR_ESCO_3_MBPS_MODE_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH             180    /* Bytes  */
        #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH            180    /* Bytes  */
    #elif (PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH             180    /* Bytes  */
        #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH            180    /* Bytes  */
    #elif(PRH_BS_CFG_SYS_LMP_EV5_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH                 180    /* Bytes  */
        #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH                180    /* Bytes  */
    #elif(PRH_BS_CFG_SYS_LMP_EV4_PACKETS_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH                 120    /* Bytes  */
        #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH                120    /* Bytes  */
    #else
        #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH                 60     /* Bytes  */
        #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH                60     /* Bytes  */
    #endif

    #if (PRH_BS_CFG_SYS_FLEXIBLE_DATA_BUFFER_SIZES_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                 360    /* 180bytes x 2 */
    #elif(PRH_BS_CFG_SYS_LMP_EDR_ESCO_3_MBPS_MODE_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                 1080   /* 540 bytes x 2 */
    #elif (PRH_BS_CFG_SYS_LMP_EDR_ESCO_2_MBPS_MODE_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                 720   /* 360 bytes x 2 */
    #elif (PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_SUPPORTED==1)
        #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                 360    /* 180bytes x 2 */
    #endif

#elif COMBINED_HOST==1
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_COMMAND_HEAP                  0x20 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_COMMANDS                         2

    #define PRH_BS_CFG_SYS_SIZEOF_HCI_EVENT_HEAP                    0x100 /* Bytes  */   //original value was 0x100, but 40 is enough for now, changed by xzc
    #define PRH_BS_CFG_SYS_MAX_HCI_EVENTS                           4            //original value was 5, but 2 is ennough for now, changed by xzc

    #define PRH_BS_CFG_SYS_SIZEOF_LMP_IN_HEAP                       0x20  /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_LMP_IN_MESSAGES                      3

    #define PRH_BS_CFG_SYS_LMP_OUT_PACKET_LENGTH               0x11  /* Bytes  */
    #define PRH_BS_CFG_SYS_NUM_LMP_OUT_PACKETS                     10

    #define PRH_BS_CFG_SYS_NUM_IN_ACL_PACKETS                   2     /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_ACL_PACKETS                  8     /* Buffers*/ //original value was 4, but 8 is need in many case
    #define PRH_BS_CFG_SYS_NUM_IN_SCO_PACKETS                   2     /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_SCO_PACKETS                  2     /* Buffers*/

    #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH                     60    /* Bytes  */
    #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH                    60    /* Bytes  */
    #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                     60    /* 30bytes x 2 */

#else /* Minimum configuration */
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_COMMAND_HEAP                  0x120 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_COMMANDS                         2

    #define PRH_BS_CFG_SYS_SIZEOF_HCI_EVENT_HEAP                    0x120 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_EVENTS                           8

    #define PRH_BS_CFG_SYS_SIZEOF_LMP_IN_HEAP                       0x30  /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_LMP_IN_MESSAGES                      4

    #define PRH_BS_CFG_SYS_LMP_OUT_PACKET_LENGTH               0x11  /* Bytes  */
    #define PRH_BS_CFG_SYS_NUM_LMP_OUT_PACKETS                     10

    #define PRH_BS_CFG_SYS_NUM_IN_ACL_PACKETS                   2     /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_ACL_PACKETS                  4     /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_IN_SCO_PACKETS                   2     /* Buffers*/
    #define PRH_BS_CFG_SYS_NUM_OUT_SCO_PACKETS                  2     /* Buffers*/

    #define PRH_BS_CFG_SYS_SCO_IN_PACKET_LENGTH                     60    /* Bytes  */
    #define PRH_BS_CFG_SYS_SCO_OUT_PACKET_LENGTH                    60    /* Bytes  */
    #define PRH_BS_CFG_SYS_SIZEOF_ESCO_OUT_HEAP                     60    /* 30bytes x 2 */
#endif

#if (PRH_BS_CFG_SYS_EXTRA_SYN_LINKS_SUPPORTED==1)
    #define PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS 4
#elif (COMBINED_HOST==1)
#if(RDA_PRODUCT&RDA_HID_HEADSET)
    #define PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS 1
#elif(RDA_PRODUCT&RDA_CORDLESS_PHONE)
    #define PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS 3
#else
    #define PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS 1
#endif
#else
    #define PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS 3
#endif

/*
 * Major configuration parameters for Piconet Devices
 */
#if (PRH_BS_CFG_SYS_PICONET_SUPPORTED==1)
    #define PRH_MAX_DEVICES_SUPPORTED                               10
    #define PRH_BS_CFG_SYS_MAX_ACTIVE_DEVICES_PICONET               7
    #define PRH_BS_CFG_SYS_MAX_PICONETS                             ((PRH_BS_CFG_SYS_SCATTERNET_SUPPORTED) ? 4:2)
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS                            ((PRH_BS_CFG_SYS_SYN_VIA_HCI_SUPPORTED) ? PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS:1)
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS_VIA_ACL                    ((PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED) ? PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS:0)
#elif COMBINED_HOST==1
    #define PRH_MAX_DEVICES_SUPPORTED                               2
    #define PRH_BS_CFG_SYS_MAX_ACTIVE_DEVICES_PICONET               2   // original value is 2, but 1 is enough for now, changed by xzc
    #define PRH_BS_CFG_SYS_MAX_PICONETS                             2
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS                            PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS_VIA_ACL                    ((PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED)? PRH_BS_CFG_SYS_MAX_ALLOWABLE_SYN_LINKS:0)
#else /* Minimum configuration */
    #define PRH_MAX_DEVICES_SUPPORTED                               1
    #define PRH_BS_CFG_SYS_MAX_ACTIVE_DEVICES_PICONET               1
    #define PRH_BS_CFG_SYS_MAX_PICONETS                             2
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS                            1
    #define PRH_BS_CFG_SYS_MAX_SYN_LINKS_VIA_ACL                    ((PRH_BS_CFG_SYS_SYN_VIA_ACL_SUPPORTED) ? 1:0)
#endif

/*
 * MAX_ACTIVE_DEVICE_LINKS,  must allow 1 for local for bcast.
 */
#define PRH_BS_CFG_SYS_MAX_DEVICE_CONTAINERS            (PRH_MAX_DEVICES_SUPPORTED)

#define MAX_ACTIVE_DEVICE_LINKS                         (PRH_BS_CFG_SYS_MAX_DEVICE_CONTAINERS + 1/*local*/)


#if PRH_BS_CFG_SYS_MAX_ACTIVE_DEVICES_PICONET > 7
#error The Max number of devices in the piconet must be <= 7
#endif

#if PRH_BS_CFG_SYS_MAX_ACTIVE_DEVICES_PICONET > PRH_MAX_DEVICES_SUPPORTED
#error The Max number of devices in the piconet must be <= total number of devices supported (ie both active and parked)
#endif

/*
 *  Number of extended SCO channels supported.
 */
#if (PRH_BS_CFG_SYS_LMP_EXTENDED_SCO_SUPPORTED == 1)
    #define PRH_BS_CFG_SYS_NB_SUPPORTED_EXTENDED_SCO_CHANNEL PRH_BS_CFG_SYS_MAX_SYN_LINKS
#else
    #define PRH_BS_CFG_SYS_NB_SUPPORTED_EXTENDED_SCO_CHANNEL 0
#endif

/*
 * HOP_MODES supported based on enumerators of t_rfSelection
 */
#define HOP_MODE_SINGLE_FREQ                            0
#define HOP_MODE_EUROPE_USA_FREQ                        1
#define HOP_MODE_FRANCE_FREQ                            3
#define HOP_MODE_REDUCED_FREQ                           5

#ifndef PRH_BS_CFG_SYS_HOP_MODE
#define PRH_BS_CFG_SYS_HOP_MODE                         HOP_MODE_EUROPE_USA_FREQ
#endif


/*
 * Conditional Definitions
 */
#if  (BUILD_TYPE==UNIT_TEST_BUILD) || defined(HAL_TRANSPORT_USB)
    #define PRH_BS_CFG_SYS_LOW_POWER_MODE_SUPPORTED 0
#else
    #define PRH_BS_CFG_SYS_LOW_POWER_MODE_SUPPORTED 1
#endif

#if (PRH_BS_CFG_SYS_LOW_POWER_MODE_SUPPORTED==1)
    /*
     * Note:
     * The ability of a platform to support sleep functionality is dependent on
     * the availability of a low frequency oscilalator (LFO).
     *
     * The availability of this LFO is indicated by :
     *  SYS_LF_OSCILLATOR_PRESENT     (hal/___platform___/sys/include/"sys_hal_features.h" )
     */
    #define PRH_BS_CFG_SYS_SLEEP_MASTER_SUPPORTED       1
    #define PRH_BS_CFG_SYS_SLEEP_SLAVE_SUPPORTED        1
    #define PRH_BS_CFG_SYS_SLEEP_IN_STANDBY_SUPPORTED   1
#else
    #define PRH_BS_CFG_SYS_SLEEP_MASTER_SUPPORTED       0
    #define PRH_BS_CFG_SYS_SLEEP_SLAVE_SUPPORTED        0
    #define PRH_BS_CFG_SYS_SLEEP_IN_STANDBY_SUPPORTED   0
#endif


/*
 * Support for Tabasco2 hardware features
 */
#if (PRH_BS_CFG_TABASCO_VERSION >= PRH_BS_HW_TABASCO_VERSION_P7_5_0)
    #define PRH_BS_CFG_SYS_HW_INDIVIDUAL_TIM_INTR_CLR       1
#else
    #define PRH_BS_CFG_SYS_HW_INDIVIDUAL_TIM_INTR_CLR       0
#endif

/*
 * Define default PRTH device as combination key device.
 * Changing this to 0 converts device into a unit key device.
 */
#define PRH_BS_CFG_SYS_COMBINATION_KEY_DEVICE_SUPPORTED     1

/*
 * Choose between unparking using LMP_unpark_PM_ADDR_req
 * or using LMP_unpark_BD_ADDR_req PDUs.
 */
#define PRH_BS_CFG_SYS_UNPARK_USING_BDADDR_ONLY_SUPPORTED   0


#if (PRH_BS_CFG_SYS_TRACE_VIA_HCI_SUPPORTED==1)
/*
 * Must increase event queues to support LMP logging on HCI Event Queue
 * Size necessary to support testing of full length Remote Name Requests
 */
    #undef PRH_BS_CFG_SYS_SIZEOF_HCI_EVENT_HEAP
    #undef PRH_BS_CFG_SYS_MAX_HCI_EVENTS
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_EVENT_HEAP                0x500 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_EVENTS                       64
    #define PRH_BS_CFG_SYS_HCI_EVENTS_ADD_FOR_DEBUG             56
    #define PRH_BS_CFG_SYS_EVENT_HEAP_ADD_FOR_DEBUG             0x300
#endif

#if (PRH_BS_CFG_SYS_TRACE_VIA_HCI_SUPPORTED==1)
/*
 * Must define event queues to support LMP logging on HCI Event Queue
 * Size necessary to support testing of full length Remote Name Requests
 */
    #define PRH_BS_CFG_SYS_SIZEOF_HCI_DEBUG_HEAP                0x500 /* Bytes  */
    #define PRH_BS_CFG_SYS_MAX_HCI_DEBUG_EVENTS                 64
#endif

#if (PRH_BS_CFG_SYS_BROADCAST_NULL_IN_INQ_PAGE_SUPPORTED==1)
/*
 * Must be multiple of 5 and not the power of 2
 * The max value is 400 but as broadcast must be least
 */
    #define PRH_BS_CFG_SYS_EMERGENCY_POLL_SLOTS                 100
#endif

#if (PRH_BS_CFG_SYS_AUTOMATIC_R2P_SUPPORTED==1)
/*
 * With high accurate clock the device will lost syncronization
 */
    #define PRH_BS_CFG_SYS_MAX_POSSIBLE_SYNC_SLOTS              400
#endif


/*
 * Override definitions for specific builds based on BUILD_TYPE
 */
#if (BUILD_TYPE==UNIT_TEST_BUILD)
    #undef NDEBUG
    #undef STATIC                   /* Allow test access to static structures*/
    #define STATIC
    #define PRTH_BS_DBG_BB_PACKET_LOG_TYPE                          PACKETLOG_VALID_NOWRAP_PRINT
    #define PRTH_BS_DBG_MAX_BB_MAX_PACKETS_IN_LOG                   500

#elif (BUILD_TYPE==RF_TESTER_BUILD)
    #define PRTH_BS_DBG_BB_PACKET_LOG_TYPE                          PACKETLOG_VALID_NOWRAP_PRINT
    #define PRTH_BS_DBG_MAX_BB_MAX_PACKETS_IN_LOG                   50
    #undef NDEBUG

#elif (BUILD_TYPE==COMBINED_BUILD)
    #define PRH_BT_COMBINED 1

#elif (BUILD_TYPE==GENERIC_BUILD)
    #define PRH_BT_GENERIC 1
#endif
/*
 * Feature to extend pin code timeout #2778
 */
#if defined (SHOGA)
    #define PRH_BS_CFG_SYS_PIN_CODE_REQ_EXTEND          1
#else
    #define PRH_BS_CFG_SYS_PIN_CODE_REQ_EXTEND          0
#endif


#endif


